#ifndef IMAGE_MANAGER_H_
#define IMAGE_MANAGER_H_

// INCLUDES //
#include "graphics/surface.h"
#include <string>
#include <vector>
//////////////

using namespace std;

/// The screen width the resources are scaled
const int RESOURCE_STANDARD_WIDTH = 1600;
/// The screen heigh the resources are scaled
const int RESOURCE_STANDARD_HEIGHT = 1200;
/// Number of resources
const int NUM_IMAGES = 16;
/// The image mappings
const int IMAGE_MAPPING[][4] = 
{
	{0,0,420,768}, 		// puzzle background
	{620,40,200,100},	// player background
	{420,0,40,40},		// blue gem
	{460,0,40,40},		// red gem
	{500,0,40,40},		// green gem
	{540,0,40,40},		// yellow gem
	{580,0,40,40},		// black gem
	{620,0,40,40},		// white gem
	{660,0,40,40},		// hover
	{620,140,200,10},	// player health
	{620,150,200,10},	// player deck size
	{420,40,200,668},	// hand region background
	{620,160,180,100},	// card background
	{620,260,180,100},	// card background (hover)
	{800,160,100,260},	// queue region background
	{620,360,170,170}	// alignment region background
};

/// Image ID, for use to obtain the image.
enum XYNE_IMAGE
{
	IMAGE_PUZZLE_BACKGROUND = 0,
	IMAGE_PLAYER_BACKGROUND,
	IMAGE_BLUE_GEM,
	IMAGE_RED_GEM,
	IMAGE_GREEN_GEM,
	IMAGE_YELLOW_GEM,
	IMAGE_BLACK_GEM,
	IMAGE_WHITE_GEM,
	IMAGE_GEM_HOVER,
	IMAGE_PLAYER_HEALTH,
	IMAGE_PLAYER_DECK_SIZE,
	IMAGE_HAND_REGION_BACKGROUND,
	IMAGE_CARD_BACKGROUND,
	IMAGE_CARD_BACKGROUND_HOVER,
	IMAGE_QUEUE_REGION_BACKGROUND,
	IMAGE_ALIGNMENT_REGION_BACKGROUND
};

/**
* The ImageManager is responsible for the loading of image resources, scaling them when the resolution changes, and releasing them.
* 
* @author dfoelber
**/
class ImageManager
{
public:
	/**
	* Singleton accessor
	* 
	* @return Singleton instance
	**/
	static ImageManager* GetManager();
	
	/**
	* Deconstructor
	**/
	~ImageManager();
	
	/**
	* Loads images into memory
	**/
	void LoadImages();
	
	/**
	* Gets an image
	* 
	* @param id The image ID
	* @param The surface
	**/
	Surface* GetImage( XYNE_IMAGE id );
	
	/**
	* Creates a new surface and returns it.
	* 
	* @param resolutionWidth Desired width to scale the image
	* @param resolutionHeight Desired height to scale the image
	* @param The surface
	**/
	Surface* CreateImage( int width, int height );
	
private:
	/**
	* Private constructor
	**/
	ImageManager();
	
private:
	/**
	* Singleton instance
	**/
	static ImageManager* 			instance;
	
	/**
	* List of currently loaded images
	*/
	vector<Surface*>				surfaces;
	
	/**
	* The image map
	*/	
	Surface*						map;
};

#endif /*IMAGE_MANAGER_H_*/
